package com.water.camera.util;

import android.text.TextUtils;

import java.util.Locale;

public class HVEUtil {

    public static boolean isLegalImage(String path) {
        return isImageByPath(path);
    }

    public static boolean isImageByPath(String imagePath) {
        if (TextUtils.isEmpty(imagePath)) {
            return false;
        }
        String localPath = imagePath.trim();
        return localPath.toLowerCase(Locale.ENGLISH).endsWith(".jpg")
                || localPath.toLowerCase(Locale.ENGLISH).endsWith(".jpe")
                || localPath.toLowerCase(Locale.ENGLISH).endsWith(".png")
                || localPath.toLowerCase(Locale.ENGLISH).endsWith(".gif")
                || localPath.toLowerCase(Locale.ENGLISH).endsWith(".jpeg")
                || localPath.toLowerCase(Locale.ENGLISH).endsWith(".bmp")
                || localPath.toLowerCase(Locale.ENGLISH).endsWith(".wbmp")
                || localPath.toLowerCase(Locale.ENGLISH).endsWith(".webp")
                || localPath.toLowerCase(Locale.ENGLISH).endsWith(".heic")
                || localPath.toLowerCase(Locale.ENGLISH).endsWith(".dng")
                || localPath.toLowerCase(Locale.ENGLISH).endsWith(".arw")
                || localPath.toLowerCase(Locale.ENGLISH).endsWith(".cr2")
                || localPath.toLowerCase(Locale.ENGLISH).endsWith(".nef")
                || localPath.toLowerCase(Locale.ENGLISH).endsWith(".nrw")
                || localPath.toLowerCase(Locale.ENGLISH).endsWith(".rw2")
                || localPath.toLowerCase(Locale.ENGLISH).endsWith(".orf")
                || localPath.toLowerCase(Locale.ENGLISH).endsWith(".raf")
                || localPath.toLowerCase(Locale.ENGLISH).endsWith(".pef")
                || localPath.toLowerCase(Locale.ENGLISH).endsWith(".srw")
                || localPath.toLowerCase(Locale.ENGLISH).endsWith(".heif");
    }
}
